﻿using SD.Infrastructure.Repository.EntityFrameworkCore;
using SlamDunk.MES.Domain.Entities.ExecutionContext;
using SlamDunk.MES.Domain.IRepositories.Interfaces.ExecutionContext;
using System;
using System.Collections.Generic;
using System.Linq;

namespace SlamDunk.MES.Repository.Implements.ExecutionContext
{
    /// <summary>
    /// 工单设备要求仓储实现
    /// </summary>
    public class WorkOrderEquipmentAskRepository : EFEntityRepositoryProvider<WorkOrderEquipmentAsk>, IWorkOrderEquipmentAskRepository
    {
        #region # 获取工单设备要求列表 —— ICollection<WorkOrderEquipmentAsk> Find(Guid workOrderId)
        /// <summary>
        /// 获取工单设备要求列表
        /// </summary>
        /// <param name="workOrderId">工单Id</param>
        /// <returns>工单设备要求列表</returns>
        public ICollection<WorkOrderEquipmentAsk> Find(Guid workOrderId)
        {
            IQueryable<WorkOrderEquipmentAsk> equipmentAsks = base.Find(x => x.WorkOrder.Id == workOrderId);

            return equipmentAsks.ToList();
        }
        #endregion
    }
}
